package com.fh.controller.countmoney;

import com.fh.controller.base.BaseController;
import com.fh.model.Page;
import com.fh.service.system.user.UserService;
import com.fh.util.CountMoneyUtil;
import com.fh.util.PageData;
import com.fh.util.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author LiGuangYi Date: 2017/10/17 10:07
 * @description:
 */
@RestController
@RequestMapping(value = "/count")
public class CountMoney extends BaseController {

    @Autowired
    private UserService userService;

    @Autowired
    private CountMoneyUtil countMoneyUtil;

    @RequestMapping(value = "/money/status/{id}")
    public StringBuilder getCountMoney(Page page, @PathVariable(value = "id") Integer status) {
        PageData pageData = this.getPageData();
        pageData.put("status", status);
        page.setPd(UserUtils.setDataRole(pageData, userService));
        page.setPd(UserUtils.setWWDataRole(pageData, userService));
        page.setPd(pageData);
        StringBuilder countMoney = countMoneyUtil.getCountMoney(page);
        return countMoney;
    }
}
